//
//  FXNavigationController.swift
//  微博(Swift)
//
//  Created by V on 15/12/27.
//  Copyright © 2015年 V. All rights reserved.
//

import UIKit

class FXNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if childViewControllers.count > 0 {
        var title = "返回"
        if childViewControllers.count == 1 {
            title = childViewControllers.last!.title ?? "gg"
        }
        viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "navigationbar_back_withtext", title: title, target: self, action: "back")
        viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    

    
    func back(){
        popViewControllerAnimated(true)
    }
    
    
    
    
}
